/**
 * @ClassName DosageConcentrationController
 * @Description TODO
 * @Author 沉默小吴
 * @Date 2024/12/23 15:22
 */
package com.tledu.operate.count.controller;

import com.tledu.operate.count.entity.DosageConcentration;
import com.tledu.operate.count.entity.vo.DosageConcentrationJSON;
import com.tledu.operate.count.service.IDosageConcentrationService;
import com.tledu.operate.count.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin(origins = "http://localhost")
public class DosageConcentrationController {

    @Autowired
    private IDosageConcentrationService dosageConcentrationServiceImpl;

    @GetMapping("/api/dosage-concentration")
    public Map<String,Object[]> getDosageConcentration(
            @RequestParam Long departmentId,
            @RequestParam String startDate,
            @RequestParam String endDate,
            @RequestParam(required = false) String chemicalAgentId) {
        return dosageConcentrationServiceImpl.getDosageConcentration(departmentId, DateUtils.initializeDateTimes(startDate, endDate)[0], DateUtils.initializeDateTimes(startDate, endDate)[1], chemicalAgentId);
    }
}